<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            //用户id
            $table->bigIncrements('id');
            $table->string('nickname', 200)->nullable(false)->comment('昵称');
            $table->string('password', 128)->nullable(false)->comment('密码');
            $table->string('mobile', 20)->nullable(false)->comment('手机号');
            $table->string('desc', 255)->comment('备注');
            $table->tinyInteger('level')->nullable(false)->default(false)->comment('等级');
            $table->decimal('balance', 9, 2)->nullable(false)->default(0.00)->comment('余额');
            $table->boolean('status')->nullable(false)->default(true)->comment('状态1-启用0-禁用');
            $table->timestamps();
            $table->unique('mobile');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
